home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / inventor / inventorTemplates1.1.2 / Highlight.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.3 KB  |  75 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17.  
  18.  
  19. //
  20. // Header file for "Highlight" node.
  21. // This is a simple group node that does lcoate highlighting. When
  22. // the mouse is not over the object, child 0 is displayed. When it
  23. // is over the object, child 1 is displayed.
  24. //
  25. // Author: Howard Look
  26. //
  27.  
  28. #ifndef  _HIGHLIGHT_H_
  29. #define  _HIGHLIGHT_H_
  30.  
  31. #include <Inventor/nodes/SoSeparator.h>
  32.  
  33. class Highlight : public SoSeparator {
  34.  
  35.     // Define typeId, name and field stuff
  36.     SO_SUBNODE_ID_HEADER(Highlight);
  37.     SO_SUBNODE_FIELD_HEADER(Highlight);
  38.  
  39.   public:
  40.  
  41.     // Constructor
  42.     Highlight();
  43.  
  44.     // Initializes this class
  45.     static void        initClass();
  46.  
  47.   protected:
  48.     // We might be tempted to just override changeState, but there
  49.     // is too much work to be duplicated that SoSeparator does, so
  50.     // instead we just make a simple traverse method, then make all
  51.     // the actions that will traverse only one child call it.
  52.     void        traverse(SoAction *action);
  53.     virtual void    GLRender(SoGLRenderAction *action);
  54.     virtual void    rayPick(SoRayPickAction *action);
  55.     virtual void    getBoundingBox(SoGetBoundingBoxAction *action);
  56.     virtual void    hiddenLine(SoHiddenLineAction *action);
  57.     virtual void    painters(SoPaintersAction *action);
  58.     
  59.     // This actually does work to see what was hit and to cause the
  60.     // highlight to occur.
  61.     virtual void    handleEvent(SoHandleEventAction *action);
  62.  
  63.   private:
  64.     // Destructor
  65.     ~Highlight();
  66.  
  67.     // Returns the child to traverse for the given state.
  68.     int            getWhichChild() const;
  69.  
  70.     // Should we highlight?
  71.     SbBool        highlight;
  72. };
  73.  
  74. #endif /* HIGHLIGHT_H */
  75.